export const exchangeColumns = ctx => {
  return [
    {
      prop: 'imageUrl',
      label: '图标',
      minWidth: 120,
      render: (h, row) => {
        return <img src={row.imageUrl} width="100px" height="100px"/>
      }
    },
    {
      prop: 'title',
      label: '标题',
      minWidth: 120
    },
    {
      prop: 'content',
      label: '描述文字',
      minWidth: 120
    }
  ]
}

export const stepFormRules = ctx => {
  const validMoney = (rule, value, callback) => {
    if (value && value < parseFloat(this.form.payMoney)) {
      callback(new Error('充值金额需大于等于付款金额'))
    }
    callback()
  }
  return {

    payMoney: {
      required: true,
      message: '请填写付款金额',
      trigger: 'blur'
    },
    accountMoney: [
      { required: true, message: '请填写充值金额', trigger: 'blur' },
      { validator: validMoney, trigger: 'blur' }
    ],
    sDT: { required: true, message: '请选择有效时间', trigger: 'blur' },
    isShowText: {
      required: true,
      message: '请选择是否展示文本',
      trigger: 'blur'
    },
    showText: {
      required: true,
      message: '请输入展示推荐文本',
      trigger: 'blur'
    },
    isRecommend: {
      required: true,
      message: '请选择是否设为推荐',
      trigger: 'blur'
    },
    allCompanyCanUse: {
      required: true,
      message: '请选择是否所有公司可用',
      trigger: 'blur'
    },
    companyCanNotUse: {
      required: true,
      message: '请选择不可用公司',
      trigger: 'blur'
    },
    exchangeRule: {
      required: true,
      message: '请输入兑换规则',
      trigger: 'blur'
    }
  }
}
